package hi.Android;


import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;

import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;

public class HelloActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
            
        public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.main);
			Button B1 = (Button) findViewById(R.id.tts);
			//Button B2 = (Button) findViewById(R.id.tti);
			B1.setOnClickListener(new View.OnClickListener() 
			{
	    		public void onClick(View v)
	    		{
	    			EditText nameField = (EditText) findViewById(R.id.input);  
	    			String name = nameField.getText().toString();
	    			TextToSpeech obj=new TextToSpeech();
	    			try {
						obj.getTextToSpeech(name);
					} catch (Exception e1) {
						e1.printStackTrace();
					}	    			
	    		}
	    	});
 
 Spinner spinner = (Spinner) findViewById(R.id.spinner1);
 ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
         this, R.array.services_array, android.R.layout.simple_spinner_item);
 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 spinner.setAdapter(adapter);
                  	
    	/*B2.setOnClickListener(new View.OnClickListener() 
    	{
    		public void onClick(View v)
    		{
    			EditText nameField = (EditText) findViewById(R.id.input);  
    			String name = nameField.getText().toString();
    			ImageSearch obj1=new ImageSearch();
    			String abc[]= null;
    			try {
					abc=obj1.ImageSearch1(name);
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
    			for(int j=0;j<abc.length;j++)
    			{
    			Intent i = new Intent(Intent.ACTION_VIEW);  
                i.setData(Uri.parse(abc[j]));  
                startActivity(i);
    			}
    			//{
    		//Drawable d = LoadImageFromWebOperations(abc.get(i));
    			//}
    		}
    	});*/
    	
    	/*
    	 * ==NYI==
    	 * 
    	 * Click Listener for the TTN functionality:
    	 * 
    	 * Input gets sent to the TTN method (or class).
    	 */
    	
    	/*B3.setOnClickListener(new View.OnClickListener()
    	{
    		public void onClick(View v)
    		{
    			EditText nameField = (EditText) findViewById(R.id.input);  
    			String name = nameField.getText().toString();
    			System.out.println("Input: " + name);
    			//Place the text in the TTN method
    		}
    	});*/
        
    	spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
    }
}